<?php
$this->headTitle($this->translator('bizprofile_user_registerenterprise_title'));
$this->headLink()
    ->appendStylesheet($this->APP_STATIC_SERVER . '/js/jquery.ui/themes/base/ui.all.css');
$this->headScript()
    ->appendFile($this->APP_STATIC_SERVER . '/js/jquery.validate/jquery.validate.min.js');
?>

<?php if($this->info != null): ?>
<script type="text/javascript" src="<?php echo $this->APP_STATIC_SERVER; ?>/js/tinymce/tiny_mce.js"></script>
<div class="t_bizprofile_register">
    <h2><?php echo $this->translator('bizprofile_user_editenterpriseinfo_title') ?></h2>
    <form method="post" action="" id="editEnterpriseInfoForm">

        <div class="clearfix">
            <label><?php echo $this->translator('info_title'); ?>:</label>
            <div class="translatable translationSourceItems">
                <?php echo $this->info->info_title ?>
            </div>
        </div>

        <div class="clearfix">
            <label><?php echo $this->translator('info_string'); ?>:</label>
            <textarea name="content" id="content" class="tinymce" style="width: 440px; height: 100px"><?php echo $this->info->info_string; ?></textarea>
        </div>

        <div class="clearfix">
            <label>&nbsp;</label>
            <?php echo $this->tokenElement; ?>
            <input type="hidden" name="info_id" value="<?php echo $this->info->info_id?>" />
            <button type="submit"><span><?php echo $this->translator('bizprofile_user_edit_button'); ?></span></button>
            <button type="reset"><span><?php echo $this->translator('bizprofile_user_register_reset_button'); ?></span></button>
        </div>
     </form>
</div>
<div id="messageDialog"></div>

<script type="text/javascript">
tinyMCE.init({
    theme: 'advanced',
    plugins: 'safari,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager,preelementfix',
    theme_advanced_buttons2: 'cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo',
    theme_advanced_buttons3: 'link,unlink,anchor,image,cleanup,code,|,preview,|,forecolor,backcolor',
    theme_advanced_buttons4: 'tablecontrols,ltr,rtl',  //"tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,fullscreen",
    theme_advanced_toolbar_location: 'top',
    theme_advanced_toolbar_align: 'left',
    width: '620',
    height: '400',
    mode: 'exact',
    elements: 'content',
    content_css: '<?php echo $this->APP_STATIC_SERVER; ?>/skins/<?php echo $this->APP_TEMPLATE; ?>/<?php echo $this->APP_SKIN; ?>/default.css',
    relative_urls: false,
    remove_script_host: false,
    onchange_callback: function(editor) {
        tinyMCE.triggerSave();
        $('#' + editor.id).valid();
    }
});

$(document).ready(function() {
    /**
    * Validate form
    */
    $('#editEnterpriseInfoForm').validate({
        rules: {
            title: {
                required: true
            }
        },
        messages: {
            title: {
                required: "<?php echo $this->translator('info_title_required'); ?>"
            }
        }
    });
});
</script>
<?php endif; ?>